﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CuongHanh.Context;
using CuongHanh.Models;
using CuongHanh.Service;

namespace CuongHanh.Controllers.FO
{
    public class OrderController : BaseController
    {
        //
        // GET: /Order/

        public ActionResult CreateOrderForGem(OrderForGem model)
        {
            if(ModelState.IsValid)
            {
                var list = CartAndPaymentContext.GetBagInfoOfGem(Session);

                if(list.Count > 0)
                {
                    bool result = OrderForGemService.Insert(model,
                            list,GetCustomerId());
                    if(result)
                    {
                        //todo redirect to payment
                    }
                    else
                    {
                        //todo thong bao loi 
                    }
                }
            }
            //todo thong bao khong hop le
            return View();
        }

    }
}
